package com.smart.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smart.entity.MachineSituation;
import com.smart.mapper.MachineSituationMapper;
import com.smart.service.IMachineSituationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 设备故障表 服务实现类
 * </p>
 *
 * @author Cookies
 * @since 2024-05-20
 */
@Service
public class MachineSituationServiceImpl extends ServiceImpl<MachineSituationMapper, MachineSituation> implements IMachineSituationService {
    @Override
    public IPage getMachineSituationList(Integer current, Integer size, String deviceId) {
        IPage page = new Page(current, size);
        return lambdaQuery()
                .eq(StrUtil.isNotBlank(deviceId), MachineSituation::getDeviceId, deviceId)
                .orderByDesc(MachineSituation::getId)
                .page(page);
    }
}
